package com.cskaoyan.day12;


public class InterfaceTest {
    public static void main(String[] args) {
        People p = new Student("学生", "男", 12);
        People p1 = new Teacher("老师", "女", 25);
        System.out.println(p.toString());
        System.out.println(p1.toString());
        Skillable sk1 = (Skillable) p;
        Skillable sk2 = (Skillable) p1;
        sk1.getSkill();
        sk2.getSkill();
    }

}

abstract class People {
    private String name;
    private String gender;
    private int age;

    public People() {
    }

    public People(String name, String gender, int age) {
        this.name = name;
        this.gender = gender;
        this.age = age;
    }

    @Override
    public String toString() {
        return "People{" +
                "name='" + name + '\'' +
                ", gender='" + gender + '\'' +
                ", age=" + age +
                '}';
    }

    public abstract void eat();

    public abstract void sleep();

}

class Student extends People implements Skillable {


    public Student(String name, String gender, int age) {
        super(name, gender, age);
    }

    @Override
    public void eat() {
        System.out.println("学生要吃饭才有精力学习");
    }

    @Override
    public void sleep() {
        System.out.println("学生不睡觉上课会打瞌睡");
    }

    @Override
    public void getSkill() {
        System.out.println("学生需要增强实践动手能力");
    }


}

class Teacher extends People implements Skillable {

    public Teacher(String name, String gender, int age) {
        super(name, gender, age);
    }

    @Override
    public void eat() {
        System.out.println("老师不吃饭没有力气讲课");
    }

    @Override
    public void sleep() {
        System.out.println("老师得睡觉才能讲课");
    }

    @Override
    public void getSkill() {
        System.out.println("老师需要增强语言能力");
    }
}

interface Skillable {
    void getSkill();
}
